package com.neusoft.utils;

import java.util.Random;

/**
 * @Author 王柯淋
 * @Date 2025/1/13 13:17
 * @DESCRIBER
 */
public class StringUtil {
    //生成随机密码
    public static String getRandomPassword() {
        // 定义密码可能包含的字符集合
        String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        int length = 8; // 密码长度，可根据需要修改
        StringBuilder password = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            int index = random.nextInt(characters.length());
            password.append(characters.charAt(index));
        }
        return password.toString();
    }
}
